#!/usr/bin/python
# -*- coding: UTF-8 -*-  

"TestBindFuncAndAttr"

__author__ = "Wang Zhe"

from types import MethodType    

class Student(object):
    """docstring for Student"""
    def __init__(self):
        super(Student, self).__init__()
        self.x = 9

    def power(self):
        return self.x ** 2


def set_age(self,age):
    self.age = age

def main():
    obj = Student()
    
    obj.name = "Wangzhe"
    print(obj.name)

    obj.set_age = MethodType(set_age,obj)
    obj.set_age(25)
    print(obj.age)


if __name__ == '__main__':
    main()